/*
 * @lc app=leetcode.cn id=101 lang=golang
 *
 * [101] 对称二叉树
 */

// @lc code=start
/**
 * Definition for a binary tree node.
 * type TreeNode struct {
 *     Val int
 *     Left *TreeNode
 *     Right *TreeNode
 * }
 */
func isSymmetric(root *TreeNode) bool {

	return Symmetric(root.Left, root.Right)
}
func Symmetric(left *TreeNode, right *TreeNode) bool {
	if left == right {
		return true
	}
	if left == nil || right == nil || right.Val != left.Val {
		return false
	}
	l := Symmetric(right.Left, left.Right)
	r := Symmetric(left.Left, right.Right)
	return l && r

}

// @lc code=end

